package com.example.demobetwixt;

import com.example.demobetwixt.po.Clss;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.oxm.castor.CastorMarshaller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import javax.annotation.Resource;
import javax.xml.transform.stream.StreamSource;
import java.io.FileInputStream;

@Controller

public class OxmTest {





    private CastorMarshaller castorMarshaller;



    @GetMapping(value = "/testMarshaller")
    public void testMarshaller() {
        FileInputStream is = null;
        try {
            is = new FileInputStream("D:\\C2.xml");


            Clss adi = (Clss) castorMarshaller.unmarshal(new StreamSource(is));

            System.out.println(adi.toString());


//            Property property = adi.getObjects().get(1).getProperties().get(15);
//            ExtInfo ei = JsonUtils.fromJson(property.getValue(), ExtInfo.class);
        } catch (Exception e) {
            e.printStackTrace();
//            log.error("testMarshaller error:",e);
        }
    }




}
